[deps]
util-macros
pixman
xorg-proto-headers
xorg-libraries
libxkbfile
freetype
libfontenc
libxau
libxdmcp
libxfont
mesalib

[main]
filesize=5502845
sha512=d5379e2f52e93985ab2636ca02f503baadd359a4ec05bed80162213392e16d433a2b7308e90cdd18c1a0bd283429f2c8b8758b5a2c585923533cced6245de989

[mirrors]
ftp://ftp.x.org/pub/individual/xserver/xorg-server-1.14.3.tar.bz2

[build]
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > test/Makefile.in
sed -i 's/termio.h/termios.h/' hw/xfree86/os-support/xf86_OSlib.h

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
LDFLAGS="-lfontenc -lfreetype -lz -lxcb -lXdmcp -lXau $optldflags" \
  CFLAGS="-D__gid_t=gid_t -D__uid_t=uid_t -DNOFILES_MAX=256 -D_GNU_SOURCE -I$butch_prefix/include/pixman-1 $optcflags" \
  ./configure -C --prefix="$butch_prefix" \
    --enable-kdrive --enable-kdrive-evdev $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

# make /etc/X11 a symlink to /share/X11, so the config can be found easily
dest="${butch_prefix}${butch_install_dir}"
mkdir -p "$dest"/etc
ln -s ../share/X11 "$dest"/etc/

#copy our hacky X launcher script to /bin...
dest="${butch_prefix}${butch_install_dir}"/bin
mkdir -p "$dest"
cp "$K"/X "$dest"/

xmoddest="${butch_prefix}${butch_install_dir}"/share/X11/xorg.conf.d
mkdir -p "$xmoddest"
cp "$K"/20-modules.conf "$xmoddest"/

# FIXME starting X as non-root needs suid bit on the "server"
chmod +s "$dest"/Xfbdev
